{% extends "misago/admin/generic/form.html" %}
{% load i18n misago_admin_form %}


{% block title %}
{% if target.pk %}
  {{ target }}
{% else %}
  {% trans "New rank" %}
{% endif %} | {{ active_link.name }} | {{ block.super }}
{% endblock title %}


{% block page-header %}
{{ block.super }}
{% if target.pk %}
  <small>
    {{ target }}
  </small>
{% endif %}
{% endblock page-header %}


{% block page-actions %}
{% if target.pk and target.is_tab %}
  <div class="col-auto page-action">
    <a href="{{ target.get_absolute_url }}" class="btn btn-primary btn-sm">
      <span class="fas fa-external-link-alt"></span>
      {% trans "View on site" %}
    </a>
  </div>
{% endif %}
{% endblock %}


{% block form-header %}
{% if target.pk %}
  {% trans "Edit rank" %}
{% else %}
  {% trans "New rank" %}
{% endif %}
{% endblock %}


{% block form-body %}
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Name and description" %}</legend>

    {% form_row form.name %}
    {% form_row form.title %}
    {% form_row form.description %}

  </fieldset>
</div>
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Permissions" %}</legend>

    {% form_row form.roles %}

  </fieldset>
</div>
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Display and visibility" %}</legend>

    {% form_row form.css_class %}
    {% form_row form.is_tab %}

  </fieldset>
</div>
{% endblock form-body %}
